#ifndef NOFOCUSDELEGATE_H
#define NOFOCUSDELEGATE_H

#include <QStyledItemDelegate>
#include <QPainter>

class NoFocusDelegate : public QStyledItemDelegate
{
    Q_OBJECT

public:

protected:
    void paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const
    {
        QStyleOptionViewItem itemOption(option);
        if (itemOption.state & QStyle::State_HasFocus)
        {
            itemOption.state = itemOption.state ^ QStyle::State_HasFocus;
        }

        QStyledItemDelegate::paint(painter, itemOption, index);
    }

private:
    QStyledItemDelegate *parent;
};

#endif // NOFOCUSDELEGATE_H
